/**
 * @file  object.cpp
 * @author Carlos Hernández García <carloshergar@usal.es>, Camilo Ruiz, Enrique Conejero
 * @date   Fri Apr  10 2009  
 *
 * Copyright (c) 2009 Carlos Hernández García
 *
 * @brief  See object.h
 *
 * 
 * Carlos Hernández García                          \n
 * <carloshergar@usal.es>                             \n
 * Universidad de Salamanca                         \n
 * Plaza de la Merced s/n                           \n
 * E-37008 Salamanca, SPAIN                         \n
 */
/********************************************************************************/


#include "../include/object.h"


particle::particle()
{
	species=0;
	fix=0;
	q=-1.;
	m=1.;
	qm=q/m;
	xp=0.;
	xpold=0.;
	vpx=0.;
	vpy=0.;
	vpz=0.;
	zn=0.;
}

particle::particle(int _species, int _fix, double _xp, double _xpold, double _vpx, double _vpy, double _vpz)
{
	if(_species==0)
	{
		q=-1.;
		m=1.;
	}
	if(_species==1)
	{
		q=1.;
		m=1836.;
	}
	qm=q/m;
	fix=_fix;
	xp=_xp;
	xpold=_xpold;
	vpx=_vpx;
	vpy=_vpy;
	vpz=_vpz;
	
}

double particle::igamma()
{
	//return sqrt(1.0 - (vpx*vpx - vpy*vpy - vpz*vpz));
	//printf("\t\tigamma: vpx=%f, vpy=%f, vpz=%f, sqrt()=%f\n", vpx, vpy, vpz, sqrt(1.0 + (vpx*vpx - vpy*vpy - vpz*vpz)/lightC_au/lightC_au));
	return 1/(sqrt(1.0 + (vpx*vpx + vpy*vpy + vpz*vpz)/lightC_au/lightC_au));
	//return sqrt(1.0 - (vpx*vpx - vpy*vpy - vpz*vpz));

}


cell1d::cell1d()
{
	vx.Ex=0;
	vx.Ey=0;
	vx.Ez=0;
	vx.Bx=0;
	vx.By=0;
	vx.Bz=0;
	vx.Fp=0;
	vx.Fm=0;
	vx.Gp=0;
	vx.Gm=0;
	vx.Jx=0;
	
	ct.Rox=0;
	ct.Roy=0;
	ct.Roz=0;
	ct.Ropx=0;
	ct.Ropy=0;
	ct.Ropz=0;
	ct.Jy=0;
	ct.Jz=0;

}
